#include "rpc.h"
#include "usr_proc.h"

void read_file(char *host, char *name, char * buf, int len)
{

    MY_DATA mydata;
    MY_DATA * mydata_reply;
    int data_len =  0;      
    memset(&mydata, 0, data_len);
    memset(&mydata_reply, 0, data_len);
    data_len = sizeof( MY_DATA);
    strncpy(mydata.name, name, sizeof(mydata.name));
    mydata.len = len;   

    mydata_reply = (MY_DATA *)rpc_req(host, 1, (void *)&mydata, data_len);

    printf("name:%s,len:%d, buf:%s\n", mydata_reply->name, mydata_reply->len, mydata_reply->buf);

    strncpy(buf, mydata_reply->buf, mydata_reply->len);
}

#ifdef MAKECLNT
int
main (int argc, char *argv[])
{
    char *host = "192.168.1.189";
    char  buf[16] ={0};
    read_file (host, "read.txt", buf, sizeof(buf));
    printf("main read:%s\n", buf);

    return 0;
}
#endif

